<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
		<meta name="format-detection" content="telephone=no">
		<title>调度移动应用</title>
		<link rel="stylesheet" href="../assets/agile/css/agile.layout.css">
		<link rel="stylesheet" href="../assets/third/seedsui/plugin/seedsui/seedsui.min.css">
		<link rel="stylesheet" href="../assets/third/seedsui/plugin/animate/animate.css">
		<link rel="stylesheet" href="../assets/third/datepicker/lCalendar.css">
		<style>
			.tab:active, .tab.active {
				color: grey;
			}
			.titlebar a i, .titlebar a label {
				color: white;
			}
			.tab-active {
				background-color: #FF9224;
				color: white;
			}
			.menubar .tab-active {
				background-color: #18B2ED;
				color: white;
			}
			.col_div {
				text-align: center;
				width: 50%;
				float: left
			}
			.card {
				margin: 5px
			}

			.list .justify-content {
				padding-top: 10px;
				padding-bottom: 10px;
				margin-left: 5px;
			}
			.bill-list .justify {
				width: 25%;
				background-color: #CCCCCC;
			}
			.bill-list .justify label {
				margin-left: 5px;
			}

			.list .bill-title {
				padding-top: 10px;
				padding-bottom: 10px;
				background-color: #1278c7;
				color: white;
			}

		</style>
	</head>
	<body style="overflow-y:hidden;">
		<div id="section_container">
			<section id="tdsj_section" data-role="section" class="active">
				<header>
					<div class="titlebar" style="text-align:center;background-color:#18B2ED">
						<a class="left" href="javascript:history.go(-1)" > <i class="icon icon-arrowleft" style="color:white"></i> </a>
						<h1 id="header_title" style="font-weight:bold;color:white" >测试接口页面</h1>
					</div>
				</header>
				<article id="sddghf_article" data-role="article" data-transition="slide" data-scroll="verticle" style="top:45px;bottom:40px;" class="active">
					<div class="scroll">
						<div id="sddghf_chart">
							<div style="color:blue" onclick="ceshi1();">
								测试客户端到前置服务端直接返回的按钮
							</div>
							<br />
							<br />
							<br />
							<div style="color:blue" onclick="ceshi2();">
								测试客户端到前置服务端到接口再返回的按钮
							</div>
						</div>
					</div>
				</article>
				<footer>

				</footer>
			</section>
		</div>
		<script src="../assets/third/jquery/jquery-2.1.3.min.js"></script>
		<script src="../assets/third/jquery/jquery.mobile.custom.min.js"></script>
		<script src="../assets/third/iscroll/iscroll-probe.js"></script>
		<script src="../assets/third/vue/vue.min.js"></script>
		<script src="../assets/third/datepicker/lCalendar4vue.js"></script>
		<script src="../custom_charts/time.js"></script>
		<script src="../custom_charts/foot.js"></script>
		<script src="../custom_charts/ddyd_charts.js"></script>
		<script src="../assets/third/echarts/echarts.min.js"></script>
		<script src="../assets/agile/js/agile.js"></script>
		<script src="../assets/app/js/app.js"></script>
		<script src="../custom_charts/base64.js"></script>
		<script scr="text/JavaScript">
			var bridgeOk = false;
			document.addEventListener("plusready", onPlusReady, false);
			function onPlusReady() {//可以写原生能力的方法
				bridgeOk = true;
			}

			var ceshi1 = function() {
				//$.ajax({
				//url : $config.serverUrl + "/getqztest",
				//async : "true",
				//type : "get",
				//dataType : "jsonp",
				//success : function(data) {
				//alert(data.list);
				//},
				//error : function() {
				//A.showToast("测试前置接口通讯失败！");
				//A.hideMask();
				//}
				//})

				//var url =$config.serverUrl+"/getqztest";
				//
				//var ajaxData = {};
				//
				//ajaxData.method = "GET";
				//
				//ajaxData.isBlock = true;
				//
				//ajaxData.url = url;
				//
				//ajaxData.successFunction = "successFunction";
				//
				//ajaxData.failFunction = "failFunction";
				//
				////设置请求编码格式
				//
				//ajaxData.reqCharset = "UTF-8";
				//
				////设置回应编码格式
				//
				//ajaxData.rspCharset = "UTF-8";
				//
				////设置连接超时时间 10秒
				//
				//ajaxData.connectTimeout = 10;
				//
				////设置读取超时时间 90秒
				//
				//ajaxData.timeout = 90;
				//
				//var ajax = new DirectAjax(ajaxData);
				//
				//ajax.send();

				//if (bridgeOk){
		 			////当服务端集成在本工程中，可以通过ClientUtil获取到服务的地址
		 			//var settingInfo = ClientUtil.getSetting();
		 			//var path= "http://"+settingInfo.ip+":"+settingInfo.port+"/process/service/"+ClientUtil.getAppId()+"/";
		 			////当服务端在别的服务工程中，就只能写好外侧服务接口的地址
		 			////path = "http://172.16.4.74:8001/process/service/myfirst/"
		 			//		 			
		 			//var ajaxData = {}
		 			//ajaxData.method = "GET";   
                    //ajaxData.isBlock = true;
                    //ajaxData.url = path+"getqztest";
                    //ajaxData.successFunction = "successFunction";
                    //ajaxData.failFunction = "failFunction";
                    //var ajax = new DirectAjax(ajaxData);
                    //ajax.send();
		 		//}
		 		
		 		if (bridgeOk){
		 			var settingInfo = ClientUtil.getSetting();
		 			var path= "http://"+settingInfo.ip+":"+settingInfo.port+"/process/service/"+ClientUtil.getAppId()+"/";
		 			alert(path)
		 			var ajaxData = {}
		 			ajaxData.method = "GET";   
                    ajaxData.isBlock = true;
                    //只有在服务端与工程在一起的时候才能这样用
                    ajaxData.url = path+"/qztest";
                    ajaxData.successFunction = "successFunction";
                    ajaxData.failFunction = "failFunction";
                    var ajax = new Ajax(ajaxData);
                    ajax.send();
		 		}

			}
			var successFunction = function(data) {
				alert(data.responseText.list);
			}
			function failFunction(directAjax) {
				alert(directAjax.objName + "请求失败,状态码" + directAjax.status);
			}

			var ceshi2 = function() {
				A.ajax({
					url : "/gettest",
					async : "true",
					type : "get",
					dataType : "jsonp",
					success : function(data) {
						alert(data.list);
					},
					error : function() {
						A.showToast("测试数据接口通讯失败！");
						A.hideMask();
					}
				})
			}
		</script>
	</body>
</html>